<<<<<<< HEAD
import dotenv from "dotenv"; //写在上面
//配置根目录下.env的环境变量
=======
import Koa from 'koa';
import router from './router';
import { Server } from 'http'
import dotenv from 'dotenv';

>>>>>>> master
dotenv.config();

import Koa from "koa";
import router from "./router";

import { Server } from "http";

//日志中间件
import AccessLogMiddleware from "../app/middleware";

const app = new Koa();

//执行路由 AccessLogMiddleware每次执行路由时都打印日志
app.use(AccessLogMiddleware).use(router.routes());

// run为Server类型
const run = (port: any): Server => {
  return app.listen(port);
};

export default run;
